<?php
class ORMOrderTask extends ORMBase {
  public function __construct() {
    parent::__construct('OrderTask');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMOrderTaskUser.class.php';
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    $epObject->date = isset($object->date) ? SimpleDate::toStamp($object->date) : 0;
    if (isset($epObject->photographers)) {
      $epObject->photographers->removeAll();
      foreach ($object->photographers as &$item) {
        $epObject->photographers[] = $this->__getEpObject_4_lvl_1_object($myManager, $item, new ORMOrderTaskUser(), 'OrderTaskUser');
      }
    }
    if (isset($epObject->videographers)) {
      $epObject->videographers->removeAll();
      foreach ($object->videographers as &$item) {
        $epObject->videographers[] = $this->__getEpObject_4_lvl_1_object($myManager, $item, new ORMOrderTaskUser(), 'OrderTaskUser');
      }
    }
    if (isset($epObject->makeups)) {
      $epObject->makeups->removeAll();
      foreach ($object->makeups as &$item) {
        $epObject->makeups[] = $this->__getEpObject_4_lvl_1_object($myManager, $item, new ORMOrderTaskUser(), 'OrderTaskUser');
      }
    }
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    require_once dirname(__FILE__) . '/ORMOrderTaskUser.class.php';
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    $object->date = SimpleDate::fromStamp($epObject->date);
    $object->photographers = array();
    if (isset($epObject->photographers)) {
      foreach ($epObject->photographers as &$item) {
        $object->photographers[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMOrderTaskUser());
      }
    }
    $object->videographers = array();
    if (isset($epObject->videographers)) {
      foreach ($epObject->videographers as &$item) {
        $object->videographers[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMOrderTaskUser());
      }
    }
    $object->makeups = array();
    if (isset($epObject->makeups)) {
      foreach ($epObject->makeups as &$item) {
        $object->makeups[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMOrderTaskUser());
      }
    }
    return $object;
  }
}
?>
